package com.zyzd.custom.widget.attributedesc;

import android.content.Context;
import android.graphics.Color;
import android.util.AttributeSet;
import android.view.Gravity;
import android.view.View;
import android.widget.TextView;

import com.zyzd.custom.util.TDevice;

/**
 * Created by lzy on 2018/6/4 0004.
 * description ${TODO}
 * <p>
 * Changed by somebody on 2018/6/4 0004
 * description ${TODO}
 */
public class AttributeDescView extends BaseAttributeDescView<TextEntity> {
    public AttributeDescView(Context context) {
        super(context);
    }

    public AttributeDescView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public AttributeDescView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @Override
    protected View createView(TextEntity item) {
        TextView textView = new TextView(getContext());
        textView.setText(String.format("%s%s", item.getPrefix(), item.getContent()));
        textView.setTextColor(Color.RED);
        textView.setGravity(Gravity.LEFT | Gravity.CENTER_VERTICAL);
        textView.setPadding(TDevice.dpToPx(5), TDevice.dpToPx(5), TDevice.dpToPx(5), TDevice.dpToPx(5));
//      textView.setGravity((item.getType() == TextEntity.TYPE_RIGHT ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL);
        return textView;
    }
}
